#include<iostream>
#include<map>
#include<vector>
#include<cstring>
using namespace std;
typedef long long LL;
const int N = 110;
int a[N];
vector<int>ans;
int n;
int main()
{
	int t;
	scanf("%d", &t);
	while (t--) {
		cin >> n;
		//ans.clear();
		memset(a, 0, sizeof(a));
		for (int i = 0; i < n; i++) {
			int x;
			cin >> x;
			a[x]++;
		}
		bool flag = 0;
		int ans = 0;
		for (int i = 1; i <= 100; i++) {
			if (a[i] >= 1) {
				if (!flag)flag = 1;
				else ans += a[i];
			}
		}
		cout << ans << endl;
	}
	return 0;
}